<?php
	header('content-type:text/html;charset=utf-8'); 
	//重要!兩種情況中都要判斷DID是否存在,DID不存在,還要判斷工單號和機台號是否為空
	//2018-3-16 11:08:32注釋:想起來好像前端就應該做判斷過濾掉這種情況
	//$GX=$_GET["nos"];
	
	$Machine = $_POST["Machine"];//工序
	$Work_order = $_POST["Work_order"];//工序
	$Capacity = $_POST["Capacity"];//班別
	$Slice = $_POST["Slice"];
	$Time = $_POST["Time"];//时间
	
	
	$conn=mysql_connect("127.0.0.1:3306","root","tdled2018");
	if (!$conn){
		die('Could not connect: ' . mysql_error());
	}
	
	mysql_select_db("tddb", $conn);
	
	mysql_query("set character set 'utf8'");//读库 
	
	mysql_query("set names 'utf8'");//写库 
	
		$SQL = "
		INSERT INTO
			`scancode`( 
				`Machine`, `Work_oder`, `Capacity`,`Slice`, `Time`) 
		VALUES (
			'".$Machine."',
			'".$Work_order."',
			'".$Capacity."',
			'".$Slice."',
			'".$Time."'
		)";
		$result = mysql_query($SQL);
		$HID = mysql_insert_id($conn);
	
		// echo "SQL=".$SQL."<br/>";
	
	echo "保存成功!";
	

?>